Ensure hoverinfo <--> hovertemplate number formatting equivalence #3968
Merged
Ensure hoverinfo <--> hovertemplate number formatting equivalence #3968
Conversation
... so that hover templates with `%{z}` can render the z value
using the same formatting as by default.
etpinard
commented
Jun 17, 2019
|
|
||
| // N.B here the ° sign is part of the formatted value for thetaunit:'degrees' | ||
| var thetaVal = angularAxis.thetaunit === 'degrees' ? Lib.rad2deg(cdi.theta) : cdi.theta; | ||
| pointData.thetaLabel = Axes.tickText(angularAxis, thetaVal, 'hover').text; |
Contributor
Author
There was a problem hiding this comment.
This here is an interesting case. In a similar scenario, note also that:
Plotly.newPlot(gd, [{
y: [1],
hovertemplate: '%{y}'
}], {
yaxis: {ticksuffix: ' --', tickprefix: '-- '}
})shows -- 1 -- in the hover labels.
Please let me know if you think ticksuffix and tickprefix should be left out.
Contributor
|
Masterly done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the default
hovertemplateformatting for flags for traces:choropleth,scattergeo,scatterpolar(gl),barpolarandscatterternary- which should be the end of this story ✅In brief, when setting
hovertemplatein a trace we sayhoverinfoflagx, we guarantee that the hover labels withhoverinfo: 'x'ORhovertemplate: '%{x}'render the same (i.e with the same number formatting).cc @plotly/plotly_js